package com.mkyong.stock;

import com.mkyong.common.HibernateUtil;
import org.hibernate.Session;

public class App {
    public static void main(String[] args) {
        System.out.println("Hibernate one to one (XML mapping)");
        Session session = HibernateUtil.getSessionFactory().openSession();
        System.out.println("session ok");

        //
        Stock stock = new Stock();
        stock.setStockCode("1");
        stock.setStockName("xx");

        //
        session.beginTransaction();
        session.save(stock);
        session.getTransaction().commit();

        System.out.println("Done");
    }
}